package com.example.demo.controller;

import com.example.common.res.CommonResponse;
import com.example.pojo.Demo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("mydemo")
public class DemoController {
    @Value("${spring.application.name}")
    private String appliName;
    @Value("${server.port}")
    private Integer port;


    @PostMapping("demo")
    public CommonResponse<Demo> demo(@RequestBody Demo req, HttpServletRequest seReq) {
        return CommonResponse.success(Demo.builder().key1(appliName).key2(String.valueOf(port)).build());
    }




}
